home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / doc / cntour04 < prev    next >
Text File  |  1997-07-08  |  2KB  |  52 lines

  1. ; This batch file creates a contour plot in which the image
  2. ; data is re-sized to fit the plot window. This example is from
  3. ; Chapter 11, "Plotting Multi-dimensional Arrays", of _Using IDL_.
  4.  
  5. ; Restore variables elev, X, and Y.
  6.  
  7. @cntour01
  8.  
  9. ; Set missing data points to a large value.
  10.  
  11. elev(WHERE(elev EQ 0)) = 1E6    
  12.  
  13. ; REBIN down to a 72 x 92 matrix.
  14.  
  15. new = REBIN(elev, 360/5, 460/5)    
  16.  
  17. ; Scale image intensities.
  18.  
  19. image = BYTSCL(elev, MIN=2658, MAX=4241)    
  20.  
  21. ; Before displaying the image, use the CONTOUR command to create
  22. ; the appropriate plot window. The plot window must be created
  23. ; before re-sizing the image data. Use the NODATA keyword to inhibit
  24. ; actually drawing the contour plot.
  25.  
  26. CONTOUR, new, X, Y, LEVELS = 2750 + FINDGEN(6) * 250., $
  27.      MAX_VALUE = 5000, XSTYLE = 1, YSTYLE = 1, TITLE='Maroon Bells Region', $
  28.      SUBTITLE = '250 meter contours', XTITLE = 'UTM Coordinates (KM)', /NODATA
  29.  
  30. ;Get size of plot window in device pixels.
  31.  
  32. PX = !X.WINDOW * !D.X_VSIZE    
  33. PY = !Y.WINDOW * !D.Y_VSIZE
  34.  
  35. ;Desired size of image in pixels.
  36.  
  37. SX = PX(1) - PX(0) + 1    
  38. SY = PY(1) - PY(0) + 1
  39.  
  40. ; Display the image with its lower-left corner at the origin of the plot 
  41. ; window and with its size scaled to fit the plot window.
  42.  
  43. TVSCL, CONGRID(image, SX, SY), PX(0), PY(0)
  44.  
  45. ; Write the contours over the image, being sure to use the exact axis 
  46. ; styles so that the contours fill the plot window. Inhibit erasing.
  47.  
  48. CONTOUR, new, X, Y, LEVELS = 2750 + FINDGEN(6) * 250., $
  49.      MAX_VALUE = 5000, XSTYLE = 1, YSTYLE = 1, TITLE='Maroon Bells Region', $
  50.      SUBTITLE = '250 meter contours', XTITLE = 'UTM Coordinates (KM)', /NOERASE
  51.  
  52.